﻿<?php require_once("includes/session.php"); ?>
<?php confirm_logged_in(); ?>
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php access_check(1,$connection); ?>
<?php include("includes/header.php"); ?>

<?php 
	
	
	
	
	
	function pazeidimai($datestart, $dateend, $burys, $pazeidrusysid, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'
			AND `burys` = ";
	$query .= "'".$burys."'";
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `pazeidrusysid` = ";
	$query .="'".$pazeidrusysid."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}

	function nuobaudos($datestart, $dateend, $burys, $nuobrusysid, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'
			AND `burys` = ";
	$query .= "'".$burys."'";
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `nuobrusysid` = ";
	$query .="'".$nuobrusysid."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}
	
	function vieta($datestart, $dateend, $burys, $vieta, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'
			AND `burys` = ";
	$query .= "'".$burys."'";
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `vieta` = ";
	$query .="'".$vieta."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}
	
	
	function pazeidimai_sum($datestart, $dateend, $burys, $pazeidrusysid, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'";
			
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `pazeidrusysid` = ";
	$query .="'".$pazeidrusysid."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}

	function nuobaudos_sum($datestart, $dateend, $burys, $nuobrusysid, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'";
			
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `nuobrusysid` = ";
	$query .="'".$nuobrusysid."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}
	
	function vieta_sum($datestart, $dateend, $burys, $vieta, $connection){
	$query = "SELECT `nuobaudosid`
			FROM `nuobaudos`
			WHERE `svarstdata` >= ";
	$query .= "'".$datestart."'";
	$query .=" AND `svarstdata` <= ";
	$query .= "'".$dateend."'";
	$query .=" AND `nuobrusysid` != '9'
			AND `nuobrusysid` != '20'";
			
	$query .=" AND `istaiga` = '1'";
	$query .=" AND `vieta` = ";
	$query .="'".$vieta."'";
	//echo $query;
	$result_set = mysql_query($query, $connection);
	echo mysql_num_rows($result_set);}
?>

<article>
	<h3>Statistinė ataskaita apie nuteistųjų paskatinimus</h3>
	<table width="150" border="1">
  <tr>
    <td rowspan="2" align="center" valign="middle">Būrys</td>
    <td rowspan="2" align="center" valign="middle">Būrio viršininkas</td>
    <td rowspan="2" align="center" valign="middle">Viso nut.</td>
    <td colspan="6" align="center" valign="middle">Paskatinimai</td>
    <td colspan="2" align="center" valign="middle">Socialiniams ryšiams</td>
    <td rowspan="2" align="center" valign="middle">Viso</td>
  </tr>
  <tr>
    <td align="center" valign="middle">Pareikšti padėką</td>
    <td align="center" valign="middle">Pan. drausm. nuobaudą</td>
    <td align="center" valign="middle">Papild. trump. pasimat.</td>
    <td align="center" valign="middle">Papild. ilg. pasim.</td>
    <td align="center" valign="middle">Perkelti iš papr. gr. į lengv. gr.</td>
    <td align="center" valign="middle">Papild. skambint telefon.</td>
    <td align="center" valign="middle">Papild. trump. pasimat.</td>
    <td align="center" valign="middle">Papild. ilg. pasimat.</td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

    
<br>

<form action="ataskaita_paskatinimai.php" method="post">
	
<table  border="0">
  <tr>
    <td>Nuo&nbsp;</td>
    <td><input name="nuo" type="date">&nbsp;</td>
  </tr>
  <tr>
    <td>Iki&nbsp;</td>
    <td><input name="iki" type="date">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input name="submit" type="submit" value="Magic">&nbsp;</td>
  </tr>
</table>

</form>
</article>
				
            
<?php require("includes/footer.php"); ?>